-
Notifications
You must be signed in to change notification settings - Fork 741
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: Allow route setting to be ""
#1352
Conversation
🦋 Changeset detectedLatest commit: 5be0c1e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
A wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.developers.workers.dev/runs/2572148204/npm-package-wrangler-1352 You can reference the automatically updated head of this PR with: npm install --save-dev https://prerelease-registry.developers.workers.dev/prs/1352/npm-package-wrangler-1352 Or you can use npx https://prerelease-registry.developers.workers.dev/runs/2572148204/npm-package-wrangler-1352 dev path/to/script.js |
packages/wrangler/src/publish.ts
Outdated
const triggers = props.triggers || config.triggers?.crons; | ||
|
||
if (config.route === "") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if one of config.routes is also ""?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are allowing for empty strings for an explicit representation of "routes not being set" and routes
is used for many routes is there a case where routes = [ "", "some-route/* ]
or just routes = [ "" ]
because I had originally coded this with those two scenarios in mind but it didn't fully make sense... like why would someone use routes
for one route anyway (I actually couldn't think of a use-case for myself)?
packages/wrangler/src/publish.ts
Outdated
const triggers = props.triggers || config.triggers?.crons; | ||
|
||
if (config.route === "") { | ||
logger.warn("Route/s is being set as an empty string"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should the user do if they see this message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wasn't discussed. I think it should include the ""
will not be published and is being ignored, or something to that effect.
Let's answer each of these questions, make sure we have tests for combinations, and then land it. |
💯 |
11f774a
to
2749b2d
Compare
Previously Wrangler1 behavior had allowed for . To keep parity it will be possible to set in the config file and represent not setting a route, while providing a warning. resolves #1329
2749b2d
to
5be0c1e
Compare
mockUpdateWorkerRequest({ enabled: false }); | ||
mockUploadWorkerRequest({ expectedType: "esm" }); | ||
mockSubDomainRequest(); | ||
mockPublishRoutesRequest({ routes: [] }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note this will only fail if we actually make a request to publish routes with a non-empty array of routes. If the API request is never made, this would pass whatever you put for routes
here.
Previously Wrangler1 had allowed for
route = ""
.Wrangler now will allow for empty
route = ""
to represent not setting a route, while providing a warning.resolves #1329